﻿using Microsoft.AspNetCore.DataProtection;
using RuoVea.ExJwtBearer;
using RuoVea.OAuthServer.Server;
using System.Security.Claims;

namespace OAuthServer.Controllers;

public class OAuthServers : IOAuthServers
{
    public OAuthServers(IDataProtectionProvider provider, IJwtHelper jwtHelper) : base(provider, jwtHelper)
    {
    }

    public override Dictionary<string,object> IssueUser(string userId)
    {
        Dictionary<string, object> claims =new Dictionary<string, object>();
        claims.Add(RuoVea.ExDto.ClaimConst.CLAINM_USERID,RuoVea.ExIdGen.IdGenerator.IdStr() );
        claims.Add(ClaimTypes.Sid, userId);
        claims.Add(ClaimTypes.Role, "admin");
        claims.Add(RuoVea.ExDto.ClaimConst.CLAINM_NAME, "admin");
        return claims;
    }
}
